#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# @Time    : 2021/8/12 18:24
# @Author  : 李中华
# @Email   : 1260429766@qq.com
# @File    : setConfig.py

import configparser
import os
from ProjectPath import projectPath

configFile = os.path.join(projectPath,'config','config.ini')

class SetConfig:
    def __init__(self):
        self.cf = configparser.ConfigParser()
        self.cf.read(configFile,'gbk')

    def setEmailConfig(self,option,value):
        '''密码回写到config文件中'''
        self.cf.set('EMAIL',option,value)
        file = open(configFile, 'w')
        self.cf.write(file)
        file.close()
        if value == self.cf.get('EMAIL','mail_pass'):
            return True
        else:
            return False

if __name__ == '__main__':
    print(SetConfig().setEmailConfig('mail_pass','111'))